package es.app.util;

import java.util.ArrayList;
import java.util.List;

public class Lista<E extends Bean> extends ArrayList<E>{
	
	private static final long serialVersionUID = 1L;
	
	private Class<E> type;
	public Lista(Class<E> type,List<E> lista){
		super(lista);
		this.type=type;
	}
	
	public String toXML(){
		StringBuffer buffer = new StringBuffer();
		
		buffer.append("<lista"+type.getSimpleName()+">");
		for(int i=0;i<size();i++){
			buffer.append(get(i).toXML());
		}
		buffer.append("</lista"+type.getSimpleName()+">");
		return buffer.toString();
	}

}
